home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 6743 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  4.1 KB

  1. Path: nut.trin.cam.ac.uk!jad1002
  2. From: jad1002@cam.ac.uk (James Dennett)
  3. Newsgroups: comp.lang.ada,comp.lang.c++,comp.lang.c,comp.lang.modula3,comp.lang.modula2
  4. Subject: Re: Hungarian notation
  5. Date: Thu, 8 Feb 1996 10:26:08
  6. Organization: University of Cambridge, England
  7. Message-ID: <jad1002.31.000A6FDA@cam.ac.uk>
  8. References: <4cud8f$gup@news.netvision.net.il> <4dttefINNo29@keats.ugrad.cs.ubc.ca> <Pine.HPP.3.91.960122145028.27524A-100000@clear.cs.byu.edu> <dewar.822407363@schonberg> <Pine.HPP.3.91.960124References: <30C40F77.53B5@swsbbs.com> <4bd <4cc2b2$11jq@navajReferences: <4cud8f$gup@news.netvision.net.il> <4dttefINNo29@keats.ugrad.cs.ubc.ca> <Pine.HPP.3.91.960122145028.27524A-100000@clear.cs.byu.edu> <dewar.822407363@schonberg> <Pine.HPP.3.91.960124References: <30C40F77.53B5@swsbbs.com> <4bd <4cc2b2$11jq@
  9. rganization: Trinity College, Cambridge
  10. NNTP-Posting-Host: nut.trin.cam.ac.uk
  11. X-Newsreader: Trumpet for Windows [Version 1.0 Rev A]
  12.  
  13. In article <hawkfish-0602960745260001@blv-pm2-ip26.halcyon.com> hawkfish@punchdeck.com (Richard Wesley) writes:
  14. >From: hawkfish@punchdeck.com (Richard Wesley)
  15. >Subject: Re: Hungarian notation
  16. >Date: Tue, 06 Feb 1996 07:45:26 -0800
  17.  
  18. >In article <Pine.HPP.3.91.960203182917.987A-100000@clear.cs.byu.edu>,
  19. >Douglas Evan Cook <cookd@cs.byu.edu> wrote:
  20.  
  21. >>On Wed, 31 Jan 1996, James Dennett wrote:
  22. >>
  23. >>> >No, but somebody must have written those methods, no?  And that somebody 
  24. >>> >needed to know how many bits each data type is, no?  When we changed from 
  25. >>> >16 bit compiler to 32 bit compiler, the data files remained the same.  
  26. >>> 
  27. >>> Herein lies your problem - you broke the ADT. If the ADT didn't specify the
  28. >>> size of the components then your code can't rely on them...
  29. >>> so the data files would not necessarily remain the same if
  30. >>> the implementation of the ADT changed.
  31. >>
  32. >>Ah, but the ADT *did* specify that the file format would remain the 
  33. >>same.  And not all users of the applications are using the same platforms 
  34. >>- some are running on 386's with 386 DOS extenders, some are running with 
  35. >>286 extenders, some are running on overlaid versions of the program done 
  36. >>for straight DOS, some are running on Windows NT, and some are running on 
  37. >>non Intel based machines.  The users expect to be able to transfer files 
  38. >>between each platform.  And so we compile, but in each platform we don't 
  39. >>want to have to modify the ADT's because of compiler dependancies.  So we 
  40. >>have the ADT's depend on typedef equivalents, so that when we need to 
  41. >>compile for a new platform we only need to change 10-12 lines in the base 
  42. >>definition file.
  43.  
  44. Do we have a problem here or not?
  45.  
  46. So, your ADT was relatively concrete and specified the implementation in
  47. some detail. (Is there a difference between an ADT and a data structure?)
  48.  
  49. In that case, there's no problem at all; you can of course hide the machine
  50. dependencies in a module (or just a file) where you would list your typedefs
  51. if you are happy to forego the optimisations offered by using native types
  52. for one type of increased portability.
  53.  
  54. Alternatively, you could use the native integers internally and just write your
  55. own I/O code. This approach would then be portable to machines of varying
  56. endian-ness, or even those legendary machines which aren't based on 8-bit
  57. chunks of memory. The encapsulation can also be made stronger (but then,
  58. where did encapsulation enter the C philosophy) as these details are all 
  59. within the implementation of the ADT, rather than in a "System Independence"
  60. module somewhere else.
  61.  
  62. Each solution  may have its place.
  63.  
  64. >So out of curiosity, how did you handle endian issues (x86s do not use
  65. >network byte order, unlike most of the rest of the hardware in the known
  66. >universe)
  67.  
  68. (Thanks for this point!)
  69.  
  70. James.
  71.  
  72. >- rmgw
  73.  
  74. >http://www.punchdeck.com/hawkfish/PunchDeck.html
  75.  
  76. >----------------------------------------------------------------------------
  77. >Richard Wesley             | "I don't know about your dreams
  78. >hawkfish@punchdeck.com     |  But mine are sort of hackneyed"
  79. >hawkfish@electricfish.com  |   - Laurie Anderson, "Talk Normal"
  80. >----------------------------------------------------------------------------
  81.  
  82.